package hu.issue.framework.web.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public abstract class SimpleController implements Controller {

	@Override
	public String handleRequest(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
		handleRequestInternal(request, response);
		return getView();
	}

	protected abstract void handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception;

	protected String getView() {
		return getClass().getSimpleName().replaceAll("Controller", "").toLowerCase() + ".jsp";
	}
}
